package com.cf.r1027_e;

import java.io.*;

public class a {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        in.nextToken(); int T = (int) in.nval;
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        in.nextToken(); int n = (int) in.nval;
        int x = (int) Math.sqrt(n);
        if (x * x != n) {
            out.println(-1);
            return;
        }
        out.println(0 + " " + x);

    }
}
